﻿using SmartMotion.Core;
using Sunny.UI;
using System;
using System.Collections.Concurrent;
using SmartMotion.Core.Mgrs;

namespace SmartMotion.AllPages.Debug
{
    public partial class FrmStationDebug : UIPage
    {
        private ConcurrentDictionary<string, VarInfo> _stations;//已添加工站

        public FrmStationDebug()
        {
            InitializeComponent();
        }

        private void FrmStationDebug_Load(object sender, EventArgs e)
        {
            _stations = StationsMgr.Ins.Stations;
            ShowStation();
        }

        private void ShowStation()
        {
            lstStation.Items.Clear();
            foreach (var station in _stations)
            {
                lstStation.Items.Add(station.Key);
            }
        }

        private void lstStation_SelectedIndexChanged(object sender, EventArgs e)
        {
            StationBase station = _stations[lstStation.SelectedItem.ToString()].Value;
            UIPage page = station.DebugPage();
            panStation.Controls.Clear();
            panStation.Controls.Add(page); page.Show();
        }
    }
}
